package com.example.mapper;

import com.example.entity.Floor;
import com.example.entity.Repair;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public interface RepairMapper {
    @Select("SELECT * FROM repair")
    List<Repair> finAll();


    int update(Repair repair);

    int insert(Repair repair);

    @Delete("DELETE FROM repair WHERE repair_num = #{repair_num} and stu_num=#{stu_num} and floor_num = #{floor_num} and layer=#{layer} and room_num=#{room_num}")
    Integer deleteBy(@Param("repair_num") Integer repair_num , @Param("stu_num") String stu_num,@Param("floor_num") String floor_num,@Param("layer") Integer layer,@Param("room_num") Integer room_num);

    List<Repair> selectPage(Integer pageNum, Integer pageSize, String floor_num);

    Integer selectTotal(String floor_num);
    @Select("SELECT * FROM repair where repair_num=#{repair_num} ")
    List<Repair> findAllBy(Integer repair_num);
    @Delete("DELETE FROM repair WHERE repair_num = #{repair_num}")
    Integer deleteBynum(String repair_num);

    List<Repair> selectPage1(Integer pageNum, Integer pageSize, String stu_num);

    Integer selectTotal1(String stu_num);
}
